package com.ckjw.gobang.view;

import javax.swing.JPanel;
import java.awt.Canvas;
import java.awt.Panel;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JFrame;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JTextField;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.SwingConstants;
import java.awt.Font;
//190 50
/**
 * 用户列表的头像
 * @author lck and djw
 * @Date 2022年6月20日-下午10:44:35
 */
public class usertx extends JPanel {
	private String id;
	private String name;
	private usertx usertx;
	public static usertx usertx2;
	public  JLabel lblNewLabel_1 ;
	JTextField textField;

	public usertx(String id, String name) {
		
		this.id = id;
		this.name = name;
		basicseetings();
	}


	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	/**
	 * Create the panel.
	 */
	public usertx() {
	basicseetings();
	}
	private void basicseetings() {
		addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				System.out.println("点击");
				
				if(UserPanel2.selectUsertx!=null)
				{
					UserPanel2.selectUsertx.lblNewLabel_1.setVisible(false);
					System.out.println(UserPanel2.selectUsertx.getId());
				}
				UserPanel2.selectUsertx=usertx;
				lblNewLabel_1.setVisible(true);
			}
		
		});
		setBackground(Color.WHITE);
		setLayout(null);
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setIcon(new ImageIcon(usertx.class.getResource("/images/maininterface/stu.png")));
		lblNewLabel.setBounds(0, 0, 57, 50);
		add(lblNewLabel);
		
		textField = new JTextField(name);
		textField.setEditable(false);
		textField.setFont(new Font("Dialog", Font.BOLD, 20));
		textField.setForeground(Color.RED);
		textField.setHorizontalAlignment(SwingConstants.CENTER);
		textField.setBounds(50, 0, 100, 50);
		add(textField);
		textField.setColumns(10);
		
		lblNewLabel_1 = new JLabel("");
		lblNewLabel_1.setIcon(new ImageIcon(usertx.class.getResource("/images/maininterface/message_selected.png")));
		lblNewLabel_1.setBounds(150, 10, 30, 30);
		lblNewLabel_1.setVisible(false);
		add(lblNewLabel_1);
		usertx=this;
		usertx2=this;
		this.setVisible(true);
	}
	
}
